/*
 * 
 */
package cz.hamacekj.dotaznikserver;

import javax.swing.JLabel;

/**
 * JLabel zobrazující číslo typu int.
 * @author Jan Hamáček
 */
class JLabelCounter extends JLabel{
    /**
     * Stejné jako JLabelCounter(0).
     */
    public JLabelCounter() {
        this(0);
    }

    public JLabelCounter(int counter, int horizontalAlignment) {
        super(Integer.toString(counter), horizontalAlignment);
    }

    public JLabelCounter(int counter){
        super(Integer.toString(counter));
        this.counter = counter;

    }

    public void inc(){
        counter++;
        setText(Integer.toString(counter));
    }

    public void dec(){
        counter--;
        setText(Integer.toString(counter));
    }
    
    public void setCounter(int counter){
        setText(Integer.toString(counter));
        this.counter = counter;
    }
    
    public int getCounter(){
        return counter;
    }

    private int counter = 0;
}

